package com.xxx.blog.controller;

import com.github.pagehelper.PageHelper;
import com.xxx.base.utils.R;
import com.xxx.blog.domain.Param;
import com.xxx.blog.service.IParamService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

@RestController
@RequestMapping("/param")
@Api(tags = "博客参数信息接口类")
public class ParamController {
    @Autowired
    private IParamService paramService;

    @GetMapping("/paramAll")
    @ApiOperation(value = "查询所有博客参数信息")
    public Map<String, String> findAll() {
        PageHelper.clearPage();
        List<Param> list = paramService.findAll();
        Map<String, String> map = list.stream().collect(Collectors.toMap(Param::getParamKey, Param::getParamValue));
        return map;
    }

}